package com.xique.system.api.factory;


import com.xique.common.core.domain.R;
import com.xique.common.core.web.domain.AjaxResult;
import com.xique.system.api.RemoteSystemLoginPageService;
import com.xique.system.api.RemoteSystemProjectService;
import com.xique.system.api.dto.SystemProjectDTO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * 日志服务降级处理
 *
 * @author xique
 */
@Component
public class RemoteSystemLoginPageFallbackFactory implements FallbackFactory<RemoteSystemLoginPageService>
{
    private static final Logger log = LoggerFactory.getLogger(RemoteSystemLoginPageFallbackFactory.class);

    @Override
    public RemoteSystemLoginPageService create(Throwable throwable)
    {
        log.error("服务调用失败:{}", throwable.getMessage());
        return new RemoteSystemLoginPageService()
        {

            @Override
            public AjaxResult autoOnOffLoginPage() {
                return AjaxResult.error("获取项目信息失败:" + throwable.getMessage());
            }
        };

    }

}
